require "formula"

class WindowsExploitSuggester < Formula
  homepage "https://github.com/GDSSecurity/Windows-Exploit-Suggester"
  url "https://github.com/GDSSecurity/Windows-Exploit-Suggester", :using => :git, :revision => '776bd91'
  version "33"
  revision 1

  resource "xlrd" do
    url "https://pypi.python.org/packages/f2/5a/62f55aef47f733e5181ded0487491a2ab2aeb38a054336f1c1ac7c788821/xlrd-0.9.4.tar.gz"
    sha256 "8e8d3359f39541a6ff937f4030db54864836a06e42988c452db5b6b86d29ea72"
  end

  def install
    ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
    ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib64/python2.7/site-packages"

    %w[xlrd].each do |r|
      resource(r).stage do
        system "python", *Language::Python.setup_install_args(libexec/"vendor")
      end
    end

    ENV.prepend_create_path "PYTHONPATH", libexec

    bin.install "windows-exploit-suggester.py"
    libexec.install Dir["*"]
    bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
  end
end
